﻿using System;
using DynamicProxy.Core;

namespace DynamicProxy.Test
{
    /// <summary>
    /// 拦截器
    /// </summary>
    public class Interceptor : IInterceptor
    {
        public object Intercept(Invocation invocation)
        {
            Console.WriteLine("{0} 执行前...", invocation.DelegateMethod.Method.Name);
            var res = invocation.Process();
            Console.WriteLine("{0} 执行后...{1}", invocation.DelegateMethod.Method.Name, Environment.NewLine);
            return res;
        }
    }
}
